//
//  RequestManager.h
//  片刻1.0
//
//  Created by lizi on 15/6/10.
//  Copyright (c) 2015年 lizi. All rights reserved.
//

#import <Foundation/Foundation.h>
//定义枚举，枚举请求的类型
typedef NS_ENUM(NSInteger,RequestModel) {
    POST,
    GET
};
//声明协议，主要用来传data的值
@protocol RequestManagerDelegate <NSObject>
//请求完毕后让代理对象执行的方法，同时把请求完整的data传给代理对象
- (void)requestDidFinishWithData:(NSData *)data;
//请求失败后把错误原因传值给代理对象
- (void)requestError:(NSError *)error;
@end
@interface RequestManager : NSObject<NSURLConnectionDataDelegate>
@property (nonatomic,retain)NSString *requestURL;
@property (nonatomic,retain)NSString *requestParameter;//请求参数
@property (nonatomic,retain)NSMutableDictionary *parameterDict;//参数字典
@property (nonatomic,assign)RequestModel requestModel;
@property (nonatomic,retain)NSMutableData *data;//接收收到的data
@property (nonatomic,assign)id<RequestManagerDelegate>delegate;//设置属性
- (instancetype)initWithRequestURL:(NSString *)urlString requestModel:(RequestModel)requestModel requestParameter:(NSString *)parameter;
//开始请求
- (void)startRequest;

@end
